#include "Vec3.h"

Vec3::Vec3(const float& x, const float& y, const float& z):
	x(x),y(y),z(z){
}

Vec3::Vec3(const Vec3& src):
	x(src.x),y(src.y),z(src.z){
}


Vec3::~Vec3(){

}

Vec3 Vec3::operator + (const Vec3& other) const{
	return Vec3(x + other.x, y + other.y, z + other.z);
}
Vec3 Vec3::operator - (const Vec3& other) const{
	return Vec3(x - other.x, y - other.y, z - other.z);
}

Vec3 Vec3::operator * (const float& scalar) const{
	return Vec3(x * scalar, y * scalar, z * scalar);
}

Vec3 Vec3::operator / (const float& scalar) const{
	return Vec3(x / scalar, y / scalar, z / scalar);
}

float Vec3::dotProduct(const Vec3& other){
	return x*other.x + y*other.y + z*other.z;
}

_p_Vec3::_p_Vec3(float* p){
	v = p;
}
_p_Vec3::~_p_Vec3(){
}

_p_Vec3& _p_Vec3::add(const Vec3& other){
	v[0]+=other.x;
	v[1]+=other.y;
	v[2]+=other.z;
	return (*this);
}

_p_Vec3& _p_Vec3::dec(const Vec3& other){
	v[0]-=other.x;
	v[1]-=other.y;
	v[2]-=other.z;
	return (*this);
}

_p_Vec3& _p_Vec3::mul (const float& scalar){
	v[0]*=scalar;
	v[1]*=scalar;
	v[2]*=scalar;
	return (*this);
}

_p_Vec3& _p_Vec3::div (const float& scalar){
	v[0]/=scalar;
	v[1]/=scalar;
	v[2]/=scalar;
	return (*this);
}
